package com.tuanzi.loan.vo.response.statistics;

import com.tuanzi.loan.core.vo.IdentityResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
public class SmsStatisticsResponse extends IdentityResponse implements Serializable{

	private Date executeTime;
	private String shortLink;
	private Integer clickCount;
	private Integer h5RegistrationCount;
	private Integer h5RegisterCount;
	private Integer loginCount;
	private Integer registerCount;
	private List<SendSmsTask> sendTasks;

	@Data
	public static final class SendSmsTask {
		private Long id;
		private Long calculateTaskId;
		private String name;
		private String content;
		private Integer platformChannel;
		private Integer sendCount;
	}

	@Data
	public static final class ActivityRegisterRecord {
		private Integer h5RegistrationCount;
		private Integer h5RegisterCount;
		private Integer loginCount;
		private Integer registerCount;
	}

	public int getSendCount() {
		int result = 0;
		for (SendSmsTask sendTask : sendTasks) {
			if (sendTask.getSendCount() != null) {
				result += sendTask.getSendCount();
			}
		}
		return result;
	}
}
